package com.leanyuan.publi.dao;

import com.leanyuan.publi.domain.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 相亲相爱一家人
 * @since 2021-05-25
 */
public interface OrdersMapper extends BaseMapper<Orders> {
    @Results(id="base",value = {
            @Result(property = "payitems.pname",column = "pname")
    }
    )
    @Select("SELECT o.*,p.pname FROM orders o inner join Payitems p on o.p_id=p.p_id WHERE house_id = #{id}")
    List<Orders> findByid(@Param("id") Integer id);
}
